package com.zzyl.mapper;

import com.github.pagehelper.Page;
import com.zzyl.dto.UserDto;
import com.zzyl.entity.User;
import com.zzyl.entity.UserRole;
import com.zzyl.vo.UserVo;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface UserIdMapper {
    //用户分页
    Page<List<UserVo>> userpage(UserDto userDto);

    //用户修改
    int update(User user);

    //启用禁用
    void updateStatr(User user);
    //用户列表
//    @Select("select * from sys_user")
    List<User> list(UserDto userDto);

    int delete(String userId);

    //是否分配用户
    @Select("select count(id) from sys_user where post_no = #{postId}")
    Integer isUser(String postId);

    @Select("SELECT COUNT(1) FROM sys_user where dept_no = #{deptId}")
    Integer IsUser(String postId);

    Page<List<User>> selectPage(UserDto userDto);
    //用户添加
    int insert(User user);

    @Update("update sys_user set password=#{newPsd} where id = #{userId}")
    void resetPwd(@Param("userId") String userId,@Param("newPsd") String newPsd);
}
